package com.haixin.test.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * 请修改注释
 *
 * @author zhangjianshe
 * @date 2021.07.18
 */
@RestController
public class MySqlController {

    @Autowired
    JdbcTemplate jdbcTemplate;
    @RequestMapping(value = "/hello",method = RequestMethod.GET)
    public String index(){
        String sql = "select mobile from user where id = ?";
        String mobile = (String)jdbcTemplate.queryForObject(sql,new Object[]{1},String.class);

        return "Hello "+ mobile;
    }
}
